package com.lixinyue.exer;

public class Account {
    private int id;
    private  double balance;
    private double annualintesestRate;
    public Account(int id,double balance,double annualintesestRate)
    {
        this.id=id;
        this.balance=balance;
        this.annualintesestRate=annualintesestRate;

    }
    public int getId(){
        return id;
    }
    public double getBalance(){
        return balance;
    }
    public double getAnnualintesestRate(){
        return  annualintesestRate;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public void setAnnualintesestRate(double annualintesestRate) {
        this.annualintesestRate = annualintesestRate;
    }
    public  void  withdraw(double amount)
    {
        if(balance>amount)
        {
            balance-=amount;
            System.out.println("成功取出"+amount);
        }else
        {
            System.out.println("余额不足，取款失败");

        }

    }
    public void deposit (double amount)
    {
        if(amount>0)
        {
            balance+=amount;
            System.out.println("成功存入"+amount);
        }

    }
}
